package com.zc.topmod.router;;

import com.zc.topmod.handler.TopModCalHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.RequestPredicates;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;

/**
 * @ClassName ApiRouter
 * @Description api路由
 * @Author luxin
 * @Date 2018/11/29 上午9:57
 * @Version 1.0
 */
@Configuration
public class ApiRouter {

    /**
     * hubble测试接口
     * @param topModCalHandler
     * @return
     */
    @Bean
    public RouterFunction<ServerResponse> routeGetpurchaseidentifier(TopModCalHandler topModCalHandler) {
        return RouterFunctions
                .route(RequestPredicates.POST("/topModCal")
                                .and(RequestPredicates.accept(MediaType.APPLICATION_JSON_UTF8)),
                        topModCalHandler::topModCal);
    }

}
